package fuxi;

import java.util.ArrayList;

public class studentstest {
    public static void main(String[] args) {


            ArrayList<Students> list = new ArrayList<>();

            list.add(new Students(1,"张三"));
            list.add(new Students(2,"李四"));
            list.add(new Students(3,"王五"));

            System.out.println(list);
            for (int i = 0; i < list.size(); i++) {
                Students student = list.get(i);
                if (student.getName().equals("张三")){
                    student.setName("张三");
                }
                if(student.getName().equals("王五")){
                    list.remove(student);
                }
            }
            System.out.println(list);
        }
    }

